import axios from "axios"
// var a = axios.create({
//   headers: {'X-Requested-With': 'XMLHttpRequest'},
//   withCredentials:true
// });
 // axios.defaults.headers = {'X-Requested-With': 'XMLHttpRequest'};
  axios.defaults.withCredentials = true;


//var header='https://dev.hupovip.cn/hp';
//var header = 'http://10.3.8.236:8080/hp';
//var header='http://10.3.8.162:8888/hp';
//var header='http://dev.hupovip.cn:10241/mockjs/2';
var header='/hp';
//var header='http://xka2007.iok.la/hp';

export var getProductList = {
  getScenicSpot: function(json) {
    var p = axios.get(header + '/v1/product/get/list', {
      params: json
    });
    return p;
  }
}

export var getGoodsList = {
  getAllGoods: function(json) {
    var p = axios.get(header + '/v1/orders/gets', {
      params: json
    });
    return p;
  }
}

export var getMerchantsList = {
  getSJ: function(json) {
    var p = axios.get(header + '/v1/businessmen/gets/businessmen', {
      params: json
    });
    return p;
  },
  getHotel: function(json) {
    var p = axios.get(header + '/v1/businessmen/gets/hotel', {
      params: json
    });
    return p;
  },
  getDrama: function(json) {
    var p = axios.get(header + '/v1/businessmen/gets/theater', {
      params: json
    });
    return p;
  }
}

export var getEvaluateList = {
  getEvaluate: function(json) {
    var p = axios.get(header + '/v1/comments/get', {
      params: json
    });
    return p;
  }
}

export var getStatistical = {
  getProduct: function(json) {
    var p = axios.get(header + '/v1/tradeAnalysis/gets/product', {
      params: json
    });
    return p;
  }
}

export var getActivity = {
  getGiftConfig: function(json) {
    var p = axios.get(header + '/v1/marketing/tuanGift/prize/list', {
      params: json
    });
    return p;
  },
  getGiftGive: function(json) {
    var p = axios.get(header + '/v1/marketing/tuanGift/activity/list', {
      params: json
    });
    return p;
  },
  getGiftHistory: function(json) {
    var p = axios.get(header + '/v1/marketing/tuanGift/record/list', {
      params: json
    });
    return p;
  }
}

export var getParam = function(json) {
  console.log(json);
  var p = axios.get(header + '/v1/businessmen/gets/businessmen/findByParam', {
    params: json
  });
  return p;
}
